<template>
  <div>
    <!-- table -->
    <BreakSpace label="工单及车辆信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel1" :list="formList" :cols="4" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle1" />
    <BaseDialog :visible.sync="weixiugongdan" :title="'维修工单选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <SelectWeiXiuGongDan @close="weixiugongdanClose" @save="weixiugongdanSave"></SelectWeiXiuGongDan>
    </BaseDialog>
    <BaseDialog :visible.sync="zhusunjian" :title="'主损件选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Selectzhusunjian @close="zhusunjianClose" @save="zhusunjianSave"></Selectzhusunjian>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangxianxiangdaima" :title="'故障现象选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Selectguzhangxianxiang @close="guzhangxianxiangdaimanClose" @save="guzhangxianxiangdaimaSave"></Selectguzhangxianxiang>
    </BaseDialog>
    <BaseDialog :visible.sync="guzhangyuanyin" :title="'故障原因选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Selectguzhangyuanyin @close="guzhangyuanyinClose" @save="guzhangyuanyinSave"></Selectguzhangyuanyin>
    </BaseDialog>
    <BaseDialog :visible.sync="zifeigongdanFlag" :title="'自费工单选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Selectzifeigongdan @close="zifeigongdanClose" @save="zifeigongdanSave"></Selectzifeigongdan>
    </BaseDialog>
    <BaseDialog :visible.sync="jiuyuandanFlag" :title="'救援单选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Selectjiuyuandan @close="jiuyuandanClose" @save="jiuyuandanSave"></Selectjiuyuandan>
    </BaseDialog>
    <BaseDialog :visible.sync="weixiuxiangmulistaddflag" :title="'维修项目列表新增'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Weixiuxiangmulist @close="weixiuxiangmulistClose" @save="weixiuxiangmulistSave"></Weixiuxiangmulist>
    </BaseDialog>
    <BaseDialog :visible.sync="peijianhuanshangjianlistaddflag" :title="'备件换上件列表新增'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Peijianhuanshangjianlist @close="peijianhuanshangjianClose" @save="peijianhuanshangjianSave"></Peijianhuanshangjianlist>
    </BaseDialog>
    <BaseDialog :visible.sync="fujiaxiangmulistaddflag" :title="'附加项目列表新增'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <fujiaxiangmulist @close="fujiaxiangmuClose" @save="fujiaxiangmuSave"></fujiaxiangmulist>
    </BaseDialog>
    <BaseDialog :visible.sync="peijianhuanxiajianlistaddflag" :title="'备件换下件列表新增'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
      <Peijianhuanxiajianlist @close="peijianhuanxiajianClose" @save="peijianhuanxiajianSave"></Peijianhuanxiajianlist>
    </BaseDialog>
    <BreakSpace label="索赔信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel2" :list="formList1" :cols="4" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle2" />
    <BreakSpace label="维修项目列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="weixiuxiangmutable"
      :columns="columns"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
    >
      <!-- 维修项目列表新增 -->
      <!--      <template slot="controls" slot-scope="props">-->
      <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="weixiuxiangmulistadd()">添加</multiuse-button>-->
      <!--      </template>-->
    </FilterTable>
    <div style="margin-bottom: 1rem;"></div>
    <BreakSpace label="备件换上件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="peijianhuanshangjiantable"
      :columns="columns1"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="columns1 => (this.columns1 = columns1)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
    >
      <!--      <template slot="controls" slot-scope="props">-->
      <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanshangjianadd()">添加</multiuse-button>-->
      <!--      </template>-->
    </FilterTable>
    <BreakSpace label="备件换下件列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="peijianhuanxiajiantable"
      :columns="columnshuanxiajian"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="columnshuanxiajian => (this.columnshuanxiajian = columnshuanxiajian)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
    >
      <!--      <template slot="controls" slot-scope="props">-->
      <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="peijianhuanxiajianadd()">添加</multiuse-button>-->
      <!--      </template>-->
    </FilterTable>
    <BreakSpace label="附加项目列表" :containerStyle="{ marginBottom: '10px' }" />
    <FilterTable
      ref="fujiaxiangmutable"
      :columns="columnsfujiaxiangmu"
      :params="fetchParams"
      :datakey="'items'"
      :onColumnsChange="columnsfujiaxiangmu => (this.columnsfujiaxiangmu = columnsfujiaxiangmu)"
      :onRowSelectChange="selectChange"
      selectionType="single"
      :isSelectColumn="false"
    >
      <!--      <template slot="controls" slot-scope="props">-->
      <!--        <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="fujiaxiangmuadd()">添加</multiuse-button>-->
      <!--      </template>-->
    </FilterTable>
    <BreakSpace label="费用信息" :containerStyle="{ marginBottom: '10px' }" />
    <FormPanel ref="formPanel3" :list="feiyongformList" :cols="4" :formType="'add'" labelWidth="110" :isSubmitBtn="false" @formChange="formChangeHandle3" />
    <LazyLoadTab v-model="activeName" :tabMenus="menus"></LazyLoadTab>
    <div style="padding-top: 3rem;"></div>
    <div style="padding-top: 3rem;"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
<!--      <multiuse-button type="primary"   @click="tongGuo">通过</multiuse-button>-->
<!--      <multiuse-button type="primary" @click="juJue">拒绝</multiuse-button>-->
<!--      <multiuse-button type="primary" @click="boHui">驳回</multiuse-button>-->
      <multiuse-button type="primary" @click="closeDialog">关 闭</multiuse-button>
    </div>
  </div>
</template>
<script>
  // import Selectjiuyuandan from './Selectjiuyuandan.vue';
  // import SelectWeiXiuGongDan from './SelectWeiXiuGongDan.vue';
  // import Selectzhusunjian from './Selectzhusunjian.vue';
  // import Selectguzhangxianxiang from './Selectguzhangxianxiang.vue';
  // import Selectguzhangyuanyin from './Selectguzhangyuanyin.vue';
  // import Selectzifeigongdan from './Selectzifeigongdan.vue';
  // import Weixiuxiangmulist from './Weixiuxiangmulist.vue';
  // import Peijianhuanshangjianlist from './Peijianhuanshangjianlist.vue';
  // import Peijianhuanxiajianlist from './Peijianhuanxiajianlist.vue';
  // import fujiaxiangmulist from './fujiaxiangmulist.vue';
  import { newSave, editSave, quyRpPreAuth, quyRomessage, getSupplierList, getPartType, approve, cmsClaimTypeStr } from '@/api/claim/factory/AuthCheck';
  import { isFormEmpty } from '@/utils/index';
  import moment from 'moment';
  export default {
    // mixins: [dictionary],
    props: ['type', 'rowData'],
    components: {
      // SelectWeiXiuGongDan,
      // Selectzhusunjian,
      // Selectguzhangxianxiang,
      // Selectguzhangyuanyin,
      // Selectzifeigongdan,
      // Weixiuxiangmulist,
      // Peijianhuanshangjianlist,
      // Peijianhuanxiajianlist,
      // Selectjiuyuandan,
      // fujiaxiangmulist
    },
    data() {
      return {
        fileList: [],
        saveData: {}, //保存对象
        saveData1: null,
        saveData2: null,
        saveData3: null,
        saveData4: null,
        partId: null,
        supId: null,
        saveFlag: 8,
        authNo: null,
        faId: null,
        frId: null,
        addAmount: null,
        supCode: null,
        isDeleted: null,
        jiuyuandanFlag: false,
        faultAppear: null,
        labourAmount: null,
        partAmount: null,
        modelId: null,
        modelCode: null,
        outId: null,
        outName: null,
        dataList: [],
        dataList1: [],
        weixiuxiangmudataList: [],
        peijianhuanshangjiandataList: [],
        peijianhuanxiajiandataList: [],
        fujiaxiangmudataList: [],
        visible: false,
        visibleDrawer: false,
        peijianhuanxiajianlistaddflag: false,
        fujiaxiangmuCloselistaddflag: false,
        weixiuxiangmulistaddflag: false,
        peijianhuanshangjianlistaddflag: false,
        Peijianhuanxiajianlistaddflag: false,
        fujiaxiangmulistaddflag: false,
        collapse: false,
        zifeigongdanFlag: false,
        weixiugongdan: false,
        guzhangyuanyin: false,
        zhusunjian: false,
        guzhangxianxiangdaima: false,
        infoId: null,
        // topFilterInit: this.topFilterInitFun(),
        flterValue: {}, //参数
        columns: this.creatHeader(),
        columns1: this.creatHeader1(),
        columnshuanxiajian: this.columnshuanxiajian1(),
        columnsfujiaxiangmu: this.columnsfujiaxiangmu1(),
        // fetchApi: getUser,
        fetchParams: {}, //ipa 接口
        selectedRows: [], //选中经销商
        hejifeiyong: 0.0,
        gongshifeiyong: 0.0,
        peijianfeiyong: 0.0,
        sumfujiafeiyongz: 0,
        sumweixiufeiyongz: 0,
        partAmountsumz: 0,
        sumfujiafeiyong: 0,
        sumPeiJianFeiYong: 0,
        fujiaxiangmufeiyong: 0.0,
        formList: this.createFormList(),
        formList1: this.createFormList1(),
        feiyongformList: this.feiyongformList1(),
        activeName: '审核记录',
        menus: [
          {
            title: '审核记录',
            path: 'claimDemage/JiChuShuJu/YuShouQuanShenQing/jiLuAndLiShiForEdit/shenhejilu',
            params: {
              authId: this.rowData.authId
            }
          },
          {
            title: '维修历史',
            path: 'claimDemage/JiChuShuJu/YuShouQuanShenQing/jiLuAndLiShiForEdit/weixiulishi',
            // disabled: true,
            params: {
              authId: this.rowData.authId
            }
          },
          {
            title: '索赔历史',
            path: 'claimDemage/JiChuShuJu/YuShouQuanShenQing/jiLuAndLiShiForEdit/suopeilishi',
            // disabled: true,
            params: {
              vin: this.rowData.vin
            }
          },
          {
            title: '变更记录',
            path: 'claimDemage/JiChuShuJu/YuShouQuanShenQing/jiLuAndLiShiForEdit/biangengjilu',
            // disabled: true,
            params: {
              authId: this.rowData.authId
            }
          }
        ]
      };
    },
    created() {
      this.Sum();
      this.getCmsClaimTypeStr();
      this.getSupplierListStr();
      this.chuqi();
    },
    mounted() {
      console.log('************321');
      //console.log(this.$refs.fujiaxiangmutable.$refs.pageTable.GET_UPDATE_ROWS());
      this.getAuthListByauthNo(this.rowData.authId);

      this.selectRowById(this.rowData.roNo);
    },
    methods: {
      //索赔类型下拉
      async getCmsClaimTypeStr() {
        const res = await cmsClaimTypeStr({ type: 9816 });
        if (res.resultCode == 200) {
          this.formList1.find(x => x.fieldName == 'cmsClaimType').initialValue = '';
          this.formList1.find(x => x.fieldName == 'cmsClaimType').itemList = res.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
        }
      },

      //供应商下拉
      async getSupplierListStr() {
        const res = await getSupplierList();
        if (res.resultCode == 200) {
          this.formList1.find(x => x.fieldName == 'supName').initialValue = '';
          this.formList1.find(x => x.fieldName == 'supName').itemList = res.data.map(y => ({ text: y.supName, value: y.supCode }));
        }
      },sumAmount() {
        let sum = 0;
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map(x => {
          sum += Number(x.addAmount);
        });

        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map(x => {
          sum += Number(x.cmsClaimAmount);
        });

        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map(x => {
          sum += Number(x.cmsClaimPrice);
        });

        this.feiyongformList.map(x => {
          if('sumAmount' == x.fieldName) {
            x.initialValue = sum;
          }
        });

      },
      async getAuthListByauthNo(authNo) {
        let res = await quyRpPreAuth(authNo);
        let data = res.data;
        //临时属性
        this.partId = data.partId; //主损件id
        this.supId = data.supId; //供应商ID
        this.supCode = data.supCode; //供应商Code
        this.faultAppear = data.faultAppear; //故障现象
        this.labourAmount = data.labourAmount; //工时费用
        this.partAmount = data.partAmount; //备件费用
        this.modelId = data.modelId; //车型id
        this.modelCode = data.modelCode; //车型Code
        this.faId = data.faId; //故障现象主键
        this.isDeleted = data.isDeleted;
        this.addAmount = data.addAmount;
        this.sumfujiafeiyongz = data.addAmount;
        this.sumweixiufeiyongz = data.labourAmount;
        this.partAmountsumz = data.partAmount;
        // this.authNo = data.authNo;
        console.log(777777777);
        console.log(data.outId);
        this.outId = data.outId;
        this.outCode = data.outCode;

        this.frId = data.frId; //故障原因主键

        // this.prodDate = data.prodDate;

        console.log(22 / 222);
        console.log(this.outId);
        console.log(data.outId);
        console.log(22 / 222);
        //为3个form赋值
        for (let i in data.fileList) {
          this.formList1.map(y => {
            if (data.fileList[i].title == y.fieldName) {
              y.initialValue = [data.fileList[i].fileUrl];
            }
          });
        }
        for (let i in data) {
          this.formList.map(y => {
            if (i == y.fieldName) {
              y.initialValue = data[i];
            }
          });
          this.formList1.map(y => {
            if (i == y.fieldName) {
              y.initialValue = data[i];
            }
          });
          this.feiyongformList.map(y => {
            if (i == y.fieldName) {
              y.initialValue = data[i];
            }
          });
        }
        //为table赋值

        if (200 == res.resultCode) {
          let data = res.data;
          if (isFormEmpty(data)) {
            data = {};
          }
          let records = data.labourList;
          if (isFormEmpty(records)) {
            records = [];
          }
          this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_INSERT(records);
          let records1 = data.addList;
          if (isFormEmpty(records1)) {
            records1 = [];
          }
          this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_INSERT(records1);
        }
        let records2 = data.partList;
        if (isFormEmpty(records2)) {
          records2 = [];
        }
        this.$refs.peijianhuanxiajiantable.$refs.pageTable.EXECUTE_INSERT(records2);

        let records3 = data.partRList;
        if (isFormEmpty(records3)) {
          records3 = [];
        }
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_INSERT(records3);

        console.info(res);
      },

      async selectRowById(val) {
        //掉外部接口 工单号 取得工单信息
        let res = await quyRomessage({ roNo: val });
        let data = res.data;
        for (let i in data) {
          this.formList.map(y => {
            if (i == y.fieldName) {
              y.initialValue = data[i];
            }
          });
        }
      },
      async Sum() {
        console.log(99999);
        console.log(this.sumfujiafeiyong);
      },
      async chuqi() {
        const res = await getPartType({ type: 5503 });
        if (res.resultCode == 200) {
          this.formList.find(x => x.fieldName == 'authStatus').initialValue = '';
          this.formList.find(x => x.fieldName == 'authStatus').itemList = res.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
        }
      },
      formChangeHandle1(val) {
        console.log(val);
        this.saveData1 = val;
      },
      formChangeHandle2(val) {
        console.log(val);
        this.saveData2 = val;
      },
      formChangeHandle3(val) {
        console.log(val);
        this.saveData3 = val;
      },

      //搜索获取数据
      changeHandle(val) {
        this.fetchParams = val;
        console.log(val);
      },
      //选中
      selectChange(rows) {
        this.selectedRows = rows;
        console.log(this.selectedRows);
      },
      //保存
      async saveDialog() {
        this.$refs.formPanel1.SUBMIT_FORM();
        this.$refs.formPanel2.SUBMIT_FORM();
        this.$refs.formPanel3.SUBMIT_FORM();
        this.$refs.formPanelbeizhu.SUBMIT_FORM();
        let arr = [];
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map(x => {
          arr.push(x);
        });
        console.log(arr);

        let arr1 = [];
        this.$refs.peijianhuanxiajiantable.$refs.pageTable.list.map(x => {
          arr1.push(x);
        });
        console.log(arr1);

        let arr2 = [];
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map(x => {
          arr2.push(x);
        });
        console.log(arr2);

        let arr3 = [];
        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map(x => {
          arr3.push(x);
        });
        console.log(arr3);

        //维修项目
        this.saveData.labourList = arr3;
        //换上件
        this.saveData.partRList = arr2;
        //换下件
        this.saveData.partList = arr1;
        //附加项目
        this.saveData.addList = arr;

        this.saveData = Object.assign(this.saveData, this.saveData1);

        this.saveData = Object.assign(this.saveData, this.saveData2);

        this.saveData = Object.assign(this.saveData, this.saveData3);
        this.saveData = Object.assign(this.saveData, this.saveData4);
        console.log(this.saveData);
        this.saveData.authId = this.rowData.authId;
        this.saveData.partId = this.partId;
        this.saveData.supId = this.supId;
        this.saveData.supCode = this.supCode;
        this.saveData.labourAmount = this.labourAmount;
        this.saveData.partAmount = this.partAmount;
        this.saveData.modelId = this.modelId;
        this.saveData.modelCode = this.modelCode;
        this.saveData.faId = this.faId; //故障现象主键
        this.saveData.frId = this.frId; //故障原因主键
        this.saveData.outId = this.outId;
        this.saveData.isDeleted = this.isDeleted;
        this.saveData.outCode = this.outCode;
        //判断是保存还是提交 通过0 驳回1  拒绝2
        if (this.saveFlag == 0) {
          this.saveData.checkStatus = 55031003;
        } else if (this.saveFlag == 1) {
          this.saveData.checkStatus = 55031004;
        } else if (this.saveFlag == 2)  {
          this.saveData.checkStatus = 55031005;
        }
        //保存前格式化时间类型
        // //销售日期
        // this.saveData.saleDate = moment(this.saveData.saleDate).format('YYYY-MM-DD HH:mm:ss');
        // //保修起始日期
        // this.saveData.repairBeginDate = moment(this.saveData.repairBeginDate).format('YYYY-MM-DD HH:mm:ss');
        // //保修截止日期
        // this.saveData.repairEndDate = moment(this.saveData.repairEndDate).format('YYYY-MM-DD HH:mm:ss');
        // //维修开始时间
        // this.saveData.serviceBeginDate = moment(this.saveData.serviceBeginDate).format('YYYY-MM-DD HH:mm:ss');
        // //维修结束时间
        // this.saveData.serviceEndDate = moment(this.saveData.serviceEndDate).format('YYYY-MM-DD HH:mm:ss');
        // //自费备件销售日期
        // // this.saveData.selfSdate = moment(this.saveData.selfSdate).format('YYYY-MM-DD HH:mm:ss');
        // //生产日期
        // this.saveData.prodDate = moment(this.saveData.prodDate).format('YYYY-MM-DD HH:mm:ss');
        console.log(8888);
        console.log(this.saveData);
        //编辑的保存
        let res = await approve(this.saveData);

        if (res.resultCode === 200) {
          this.closeDialog('refresh');
          return this.$notify.success({ title: '提示信息', message: '审核成功' });
          this.$emit('save');
        } else {
          this.$notify.error({ title: '提示信息', message: res.errMsg || '审核失败!' });
          this.closeDialog();
        }
      },
      //维修项目列表新增
      weixiuxiangmulistadd() {
        this.weixiuxiangmulistaddflag = true;
      },
      //备件换上件列表
      peijianhuanshangjianadd() {
        this.peijianhuanshangjianlistaddflag = true;
      },
      peijianhuanshangjianlistadd() {
        this.peijianhuanshangjianlistaddflag = true;
      },
      //备件换下件列表
      peijianhuanxiajianadd() {
        this.peijianhuanxiajianlistaddflag = true;
      },
      //附加项目列表
      fujiaxiangmuadd() {
        this.fujiaxiangmulistaddflag = true;
      }, //救援单
      jiuyuandanClose() {
        this.jiuyuandanFlag = false;
      },
      jiuyuandanSave(obj) {
        this.outId = obj[0].outId;
        //救援单返显
        this.formList1.map(x => {
          if ('outNo' == x.fieldName) {
            x.initialValue = obj[0].outCode; //救援号返显
          }
        });

        this.jiuyuandanFlag = false;
      },
      selectoutNo() {
        this.jiuyuandanFlag = true;
      },
      //维修工单
      weixiugongdanClose() {
        this.weixiugongdan = false;
      },
      weixiugongdanSave(obj) {
        this.modelCode = obj[0].modelCode;
        this.modelId = obj[0].modelId;
        console.log(888888888);
        console.log(obj);
        console.log(888888888);
        this.formList.map(x => {
          if ('roNo' == x.fieldName) {
            x.initialValue = obj[0].roNo; //维修工单号返显
          }
          if ('prodDate' == x.fieldName) {
            x.initialValue = obj[0].prodDate; //生产日期
          }
          // if ('authNo' == x.fieldName) {
          //   x.initialValue = obj[0].authNo; //预授权单号
          // }
          if ('vin' == x.fieldName) {
            x.initialValue = obj[0].vin; //vin
          }
          if ('licenseNo' == x.fieldName) {
            x.initialValue = obj[0].licenseNo; //车牌号
          }
          if ('modelName' == x.fieldName) {
            x.initialValue = obj[0].modelName; //车型名称
          }

          if ('saleDate' == x.fieldName) {
            x.initialValue = obj[0].saleDate; //销售日期
          }

          if ('repairBeginDate' == x.fieldName) {
            x.initialValue = obj[0].repairBeginDate; //保修起始日期
          }

          if ('repairEndDate' == x.fieldName) {
            x.initialValue = obj[0].repairEndDate; //保修截止日期
          }

          if ('serviceBeginDate' == x.fieldName) {
            x.initialValue = obj[0].serviceBeginDate; //维修开始时间
          }
          if ('serviceEndDate' == x.fieldName) {
            //发动机号
            x.initialValue = obj[0].serviceEndDate; //维修结束时间
          }
          if ('driveMile' == x.fieldName) {
            x.initialValue = obj[0].driveMile; //行驶里程
          }
          if ('engineNo' == x.fieldName) {
            x.initialValue = obj[0].engineNo; //电机号
          }
          if ('customerName' == x.fieldName) {
            //车主姓名
            x.initialValue = obj[0].customerName;
          }
          if ('customerPhone' == x.fieldName) {
            //车主手机号
            x.initialValue = obj[0].customerPhone;
          } //送修人姓名
          // if ('serviceName' == x.fieldName) {
          //   x.initialValue = obj[0].serviceName;
          // }
          // //送修人手机号
          // if ('servicePhone' == x.fieldName) {
          //   x.initialValue = obj[0].servicePhone;
          // } //提报人
          // if ('applyName' == x.fieldName) {
          //   x.initialValue = obj[0].applyName;
          // } //联系方式
          // if ('applyPhone' == x.fieldName) {
          //   x.initialValue = obj[0].applyPhone;
          // } //车辆用途
          if ('useType' == x.fieldName) {
            x.initialValue = obj[0].useType;
          } //用户属性
          if ('customerType' == x.fieldName) {
            x.initialValue = obj[0].customerType;
          }
          //是否特殊车辆
          if ('isSpecial' == x.fieldName) {
            x.initialValue = obj[0].isSpecial;
          }
        });
        this.weixiugongdan = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //主损件
      zhusunjianClose() {
        this.zhusunjian = false;
      },
      zhusunjianSave(obj) {
        this.partId = obj[0].partId;
        this.formList1.map(x => {
          if ('partCode' == x.fieldName) {
            x.initialValue = obj[0].partCode; //主损件返显
          }
          if ('partName' == x.fieldName) {
            x.initialValue = obj[0].partName; //主损件返显
          }
          // if ('ncvcertnon' == x.fieldName) {
          //   x.initialValue = obj[0].certificateNo; //新车证件号
          // }
          // if ('ncvmobilen' == x.fieldName) {
          //   x.initialValue = obj.vtel; //客户电话
          // }
          // if ('ncvvinn' == x.fieldName) {
          //   x.initialValue = obj.vin; //vin
          // }
          // if ('ncvseriescoden' == x.fieldName) {
          //   x.initialValue = obj.seriesCode; //系列
          //   this.seriesCode = obj.seriesName;
          // }
          // if ('ncvseriesname' == x.fieldName) {
          //   x.initialValue = obj.seriesName; //车系名称
          //   this.seriesCode = obj.seriesName;
          // }

          // if ('ncvcartypecoden' == x.fieldName) {
          //   x.initialValue = obj.modelCode; //车型
          // }

          // if ('ncvcartypename' == x.fieldName) {
          //   x.initialValue = obj.salesModelName; //车型名称
          // }

          // if ('ncvbrandcoden' == x.fieldName) {
          //   x.initialValue = obj.brandCode; //品牌代码
          // }
          // if ('vengineanon' == x.fieldName) {
          //   //发动机号
          //   x.initialValue = obj.engineNo; //品牌代码
          // }
          // if ('vcertificateType' == x.fieldName) {
          //   x.initialValue = obj.vcertificateType; // this.createDictText(obj.vcertificateType,'1508', 1)
          // }
          // if ('ncvdidn' == x.fieldName) {
          //   x.initialValue = obj.ownerCode; //新车经销商
          // }
          // if ('ncvdidname' == x.fieldName) {
          //   x.initialValue = obj.dealerName; //新车经销商名称
          // }
          // if ('ncdcreate' == x.fieldName) {
          //   //出库日期
          //   x.initialValue = obj.aakDate; //aak
          // }
          // // if ('ncdnewinvoicen' == x.fieldName) {
          // //   //发票日期
          // //   x.initialValue = obj.invoiceDate;
          // // }
          // if ('dinvoicesum' == x.fieldName) {
          //   x.initialValue = obj.invoiceAmount;
          // }

          // if ('legalFlag' == x.fieldName) {
          //   x.initialValue = ''; /*清空本人/法人置换*/
          //   this.setOldData('N');
          // }
        });

        this.zhusunjian = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //故障现象
      guzhangxianxiangdaimanClose() {
        this.guzhangxianxiangdaima = false;
      },
      guzhangxianxiangdaimaSave(obj) {
        this.faId = obj[0].faultId;
        this.formList1.map(x => {
          if ('faultCode' == x.fieldName) {
            x.initialValue = obj[0].faultCode; //故障现象代码返显
          }
          if ('faultName' == x.fieldName) {
            x.initialValue = obj[0].faultName; //故障现象名称返显
          }
          if ('faultAppear' == x.fieldName) {
            x.initialValue = obj[0].faultName; //故障现象名称返显
          }
          if ('sysCode1' == x.fieldName) {
            x.initialValue = obj[0].sysCode1; //一级代码
          }
          if ('sysName1' == x.fieldName) {
            x.initialValue = obj[0].sysName1; //一级名称
          }
          if ('sysCode2' == x.fieldName) {
            x.initialValue = obj[0].sysCode2; //二级代码
          }
          if ('sysName2' == x.fieldName) {
            x.initialValue = obj[0].sysName2; //二级名称
          }
          if ('sysCode3' == x.fieldName) {
            x.initialValue = obj[0].sysCode3; //三级代码
          }
          if ('sysName3' == x.fieldName) {
            x.initialValue = obj[0].sysName3; //三级名称
          }
          if ('sysCode4' == x.fieldName) {
            x.initialValue = obj[0].sysCode4; //代码
          }
          if ('sysName4' == x.fieldName) {
            x.initialValue = obj[0].sysName4; //名称
          }
          if ('sysCode' == x.fieldName) {
            x.initialValue = obj[0].sysCode; //故障代码
          }
          if ('faultAppera' == x.fieldName) {
            x.initialValue = obj[0].faultAppera; //故障现象
          }
        });

        this.guzhangxianxiangdaima = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //故障原因
      guzhangyuanyinClose() {
        this.guzhangyuanyin = false;
      },
      guzhangyuanyinSave(obj) {
        this.frId = obj[0].frId;
        this.formList1.map(x => {
          if ('frCode' == x.fieldName) {
            x.initialValue = obj[0].frCode; //故障原因代码返显
          }
          if ('frName' == x.fieldName) {
            x.initialValue = obj[0].frName; //故障原因描述返显
          }
        });

        this.guzhangyuanyin = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //自费工单
      zifeigongdanClose() {
        this.zifeigongdanFlag = false;
      },
      zifeigongdanSave(obj) {
        this.selfNo = obj[0].selfNo;
        this.formList1.map(x => {
          if ('selfNo' == x.fieldName) {
            x.initialValue = obj[0].selfNo; //主损件号返显
          }
          if ('selfSdate' == x.fieldName) {
            x.initialValue = obj[0].selfSdate; //自费备件销售日期返显
          }
          if ('selfMile' == x.fieldName) {
            x.initialValue = obj[0].selfMile; //自费备件销售里程返显
          }
          if ('selfUseHours' == x.fieldName) {
            x.initialValue = obj[0].selfUseHours; //自费备件使用时长返显
          }
          if ('selfUseMile' == x.fieldName) {
            x.initialValue = obj[0].selfUseMile; //自费备件使用里程返显
          }
          // if ('ncvcertnon' == x.fieldName) {
          //   x.initialValue = obj[0].certificateNo; //新车证件号
          // }
          // if ('ncvmobilen' == x.fieldName) {
          //   x.initialValue = obj.vtel; //客户电话
          // }
          // if ('ncvvinn' == x.fieldName) {
          //   x.initialValue = obj.vin; //vin
          // }
          // if ('ncvseriescoden' == x.fieldName) {
          //   x.initialValue = obj.seriesCode; //系列
          //   this.seriesCode = obj.seriesName;
          // }
          // if ('ncvseriesname' == x.fieldName) {
          //   x.initialValue = obj.seriesName; //车系名称
          //   this.seriesCode = obj.seriesName;
          // }

          // if ('ncvcartypecoden' == x.fieldName) {
          //   x.initialValue = obj.modelCode; //车型
          // }

          // if ('ncvcartypename' == x.fieldName) {
          //   x.initialValue = obj.salesModelName; //车型名称
          // }

          // if ('ncvbrandcoden' == x.fieldName) {
          //   x.initialValue = obj.brandCode; //品牌代码
          // }
          // if ('vengineanon' == x.fieldName) {
          //   //发动机号
          //   x.initialValue = obj.engineNo; //品牌代码
          // }
          // if ('vcertificateType' == x.fieldName) {
          //   x.initialValue = obj.vcertificateType; // this.createDictText(obj.vcertificateType,'1508', 1)
          // }
          // if ('ncvdidn' == x.fieldName) {
          //   x.initialValue = obj.ownerCode; //新车经销商
          // }
          // if ('ncvdidname' == x.fieldName) {
          //   x.initialValue = obj.dealerName; //新车经销商名称
          // }
          // if ('ncdcreate' == x.fieldName) {
          //   //出库日期
          //   x.initialValue = obj.aakDate; //aak
          // }
          // // if ('ncdnewinvoicen' == x.fieldName) {
          // //   //发票日期
          // //   x.initialValue = obj.invoiceDate;
          // // }
          // if ('dinvoicesum' == x.fieldName) {
          //   x.initialValue = obj.invoiceAmount;
          // }

          // if ('legalFlag' == x.fieldName) {
          //   x.initialValue = ''; /*清空本人/法人置换*/
          //   this.setOldData('N');
          // }
        });

        this.zifeigongdanFlag = false;
        this.fetchParams = { ...this.fetchParams };
      }, //维修项目
      weixiuxiangmulistClose() {
        this.weixiuxiangmulistaddflag = false;
      },
      weixiuxiangmulistSave(val) {
        console.log(val);
        this.visibleAdd = false;
        this.selectedRows = val;
        this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_INSERT(val);


        let sumweixiufeiyong = 0;
        this.$refs.weixiuxiangmutable.$refs.pageTable.list.map(x => {
          sumweixiufeiyong += Number(x.cmsClaimAmount);
        });
        this.feiyongformList.map(x => {
          if ('labourAmount' == x.fieldName) {
            x.initialValue = Number(sumweixiufeiyong);
          }
        });
        this.sumweixiufeiyongz=sumweixiufeiyong;
        this.sumAmount();
        this.weixiuxiangmulistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //备件换上件
      peijianhuanshangjianClose() {
        this.peijianhuanshangjianlistaddflag = false;
      },
      fujiaxiangmuCloseSave() {
        this.fujiaxiangmuCloselistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //附加项目
      fujiaxiangmuClose() {
        this.fujiaxiangmulistaddflag = false;
      },
      fujiaxiangmuSave(val) {
        this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_INSERT(val);

        let sumfujiafeiyong = 0;
        this.$refs.fujiaxiangmutable.$refs.pageTable.list.map(x => {
          sumfujiafeiyong += Number(x.addAmount);
        });
        this.feiyongformList.map(x => {
          if ('addAmount' == x.fieldName) {
            x.initialValue = Number(sumfujiafeiyong);
          }
        });
        this.sumfujiafeiyongz=sumfujiafeiyong;
        this.sumAmount();
        this.fujiaxiangmulistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },

      //备件换上件
      fujiaxiangmuCloseClose() {
        this.fujiaxiangmuCloselistaddflag = false;
      },
      peijianhuanshangjianSave(val) {
        console.log(val);
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_INSERT(val);



        let partAmountsum = 0;
        this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map(x => {
          this.sumAmountsum += Number(x.cmsClaimPrice);
          partAmountsum += Number(x.cmsClaimPrice);
        });
        this.feiyongformList.map(x => {
          if ('partAmount' == x.fieldName) {
            x.initialValue = partAmountsum;
          }
        });
        this.partAmountsumz=partAmountsum;
        this.sumAmount();

        // this.$refs.peijianhuanshangjiantable.$refs.pageTable.list.map(x => {
        //   console.log(x.cmsClaimPrice);
        //   this.sumPeiJianFeiYong += Number(x.cmsClaimPrice);
        // });
        // this.feiyongformList.map(x => {
        //   if ('sumCmsClaimPrice' == x.fieldName) {
        //     x.initialValue = this.sumPeiJianFeiYong;
        //   }
        // });
        this.peijianhuanshangjianlistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      },
      //备件换下件
      peijianhuanxiajianClose() {
        this.peijianhuanxiajianlistaddflag = false;
      },
      peijianhuanxiajianSave(val) {
        console.log(val);
        this.$refs.peijianhuanxiajiantable.$refs.pageTable.EXECUTE_INSERT(val);
        this.peijianhuanxiajianlistaddflag = false;
        this.fetchParams = { ...this.fetchParams };
      }, //拒绝
      async juJue() {
        this.saveFlag = 2;
        this.saveDialog();
      }, //驳回
      async boHui() {
        this.saveFlag = 1;
        this.saveDialog();
        // const res = await zuofeiFun({ ids: rowData.authId, status: '55031002' });
      },
      //取消操作
      closeDialog() {
        this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
      },
      //通过
      async tongGuo() {
        this.saveFlag = 0;
        this.saveDialog();
      },
      chooseOrderNo() {
        this.visible = true;
      }, //维修工单号选择
      selectRono() {
        this.weixiugongdan = true;
      },
      selectpartCode() {
        this.zhusunjian = true;
      },
      selectfaultCode() {
        this.guzhangxianxiangdaima = true;
      },
      selectfaultReason() {
        this.guzhangyuanyin = true;
      },
      selectselfNo() {
        this.zifeigongdanFlag = true;
      },
      add() {},
      createFormList() {
        return [
          {
            type: 'INPUT',
            label: '预授权单号',
            fieldName: 'authNo',
            initialValue: '',
            placeholder: '请输入标题名称...',
            disabled: true,
          },
          {
            type: 'INPUT',
            label: '维修工单号',
            fieldName: 'roNo',
            initialValue: '',
            selfCols: '6',
            placeholder: '请输入标题名称...',
            disabled: true,
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectRono()} />
              </div>
            );
            }
          },
          {
            type: 'SELECT',
            label: '预授权状态:',
            fieldName: 'authStatus',
            initialValue: '',
            itemList: [],
            disabled: true,
          },
          {
            type: 'INPUT',
            label: 'VIN',
            fieldName: 'vin',
            initialValue: '',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '车牌号',
            fieldName: 'licenseNo',
            initialValue: '',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '车型名称',
            fieldName: 'modelName',
            initialValue: '',
            disabled: true,
          },
          {
            type: 'DATE_TIME',
            label: '销售日期',
            fieldName: 'saleDate',
            initialValue: '',
            dateFormat: 'yyyy-MM-dd',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '保修起始日期',
            fieldName: 'repairBeginDate',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '保修截止日期',
            fieldName: 'repairEndDate',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '维修开始时间',
            disabled: true,
            fieldName: 'serviceBeginDate',
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '维修结束时间',
            fieldName: 'serviceEndDate',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '行驶里程',
            fieldName: 'driveMile',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '发动机号/电机号',
            initialValue: '',
            fieldName: 'engineNo',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '生产日期',
            fieldName: 'prodDate',
            disabled: true,
            placeholder: '请输入生产日期...'
          },
          {
            type: 'INPUT',
            label: '车主姓名',
            fieldName: 'customerName',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '车主手机号',
            fieldName: 'customerPhone',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '送修人姓名',
            fieldName: 'customerName',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '送修人手机号',
            fieldName: 'customerPhone',
            disabled: true,
            placeholder: '请输入标题名称...'
          },
          {
            type: 'INPUT',
            label: '提报人',
            fieldName: 'submitName',
            placeholder: '提报人',
            disabled: true
          },
          {
            type: 'INPUT',
            label: '联系方式',
            fieldName: 'submitMobile',
            placeholder: '联系方式',
            disabled: true
          },
          {
            type: 'INPUT',
            label: '车辆用途',
            style: { minWidth: '200px' },
            disabled: true,
            fieldName: 'useType'
          },
          {
            type: 'INPUT',
            label: '用户属性',
            fieldName: 'customerType',
            placeholder: '兴趣爱好',
            disabled: true,
          },
          {
            type: 'INPUT',
            label: '是否特殊车辆',
            fieldName: 'isSpecial',
            disabled: true,
            placeholder: '请输入是否特殊车辆...',
            initialValue: '',
          }
        ];
      },
      createFormList1() {
        return [
          { type: 'SELECT', label: '索赔类型', fieldName: 'cmsClaimType', placeholder: '请选择',  disabled: true, initialValue: '', itemList: [] },
          {
            type: 'INPUT',
            label: '主损件',
            fieldName: 'partCode',
            selfCols: '6',  disabled: true,
            initialValue: '',
            placeholder: '请输入主损件...',
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectpartCode()} />
              </div>
            );
            }
          },
          {
            type: 'INPUT',
            label: '主损件名称',
            fieldName: 'partName',
            disabled: true,
            initialValue: '',
            placeholder: '请输入主损件名称...'
          },
          { type: 'SELECT', label: '供应商', fieldName: 'supName', placeholder: '请选择', initialValue: '', disabled: true,itemList: [] },
          {
            type: 'INPUT',
            label: '故障现象代码',
            selfCols: '6',
            fieldName: 'faultCode',  disabled: true,
            initialValue: '',
            placeholder: '请输入故障现象代码...',
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultCode()} />
              </div>
            );
            }
          },
          {
            type: 'INPUT',
            label: '故障现象描述',
            fieldName: 'faultName',
            disabled: true,
            initialValue: '',
            placeholder: '请输入故障现象描述...'
          },
          {
            type: 'INPUT',
            label: '一级代码',
            fieldName: 'sysCode1',
            disabled: true,
            placeholder: '请输入一级代码...'
          },

          {
            type: 'INPUT',
            label: '一级名称',
            fieldName: 'sysName1',
            disabled: true,
            placeholder: '请输入一级名称...'
          },
          {
            type: 'INPUT',
            label: '二级代码',
            fieldName: 'sysCode2',
            disabled: true,
            placeholder: '请输入二级代码...'
          },

          {
            type: 'INPUT',
            label: '二级名称',
            fieldName: 'sysName2',
            disabled: true,
            placeholder: '请输入二级名称...'
          },
          {
            type: 'INPUT',
            label: '三级代码',
            fieldName: 'sysCode3',
            disabled: true,
            placeholder: '请输入三级代码...'
          },

          {
            type: 'INPUT',
            label: '三级名称',
            fieldName: 'sysName3',
            disabled: true,
            placeholder: '请输入三级名称...'
          },

          {
            type: 'INPUT',
            label: '故障代码',
            fieldName: 'sysCode4',
            disabled: true,
            placeholder: '请输入故障代码...'
          },
          {
            type: 'INPUT',
            label: '故障现象',
            fieldName: 'faultAppear',
            disabled: true,
            placeholder: '请输入故障现象...'
          },

          {
            type: 'INPUT',
            label: '故障原因代码',
            selfCols: '6',
            fieldName: 'frCode',
            disabled: true,
            placeholder: '请输入故障原因代码...',
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectfaultReason()} />
              </div>
            );
            }
          },
          {
            type: 'INPUT',
            label: '故障原因描述',
            disabled: true,
            fieldName: 'frName',
            placeholder: '请输入故障原因描述...'
          },

          {
            type: 'INPUT',
            label: '外出救援单号',
            selfCols: '6',
            fieldName: 'outNo',
            //fieldName: 'outCode',
            disabled: true,
            placeholder: '请输入救援单号...',
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectoutNo()} />
              </div>
            );
            }
          },
          {
            type: 'INPUT',
            label: '自费工单选择',
            selfCols: '6',
            fieldName: 'selfNo',
            disabled: true,
            placeholder: '请输入自费工单选择...',
            unitRender: p => {
              return (
                <div>
                <multiuse-button icon="el-icon-search" onClick={() => this.selectselfNo()} />
              </div>
            );
            }
          },
          {
            type: 'INPUT',
            label: '自费备件销售日期',
            fieldName: 'selfSdate',
            disabled: true,
            valueFormat:'yyyy-MM-DD HH:mm:ss',
            placeholder: '请输入数量...'
          },
          {
            type: 'INPUT',
            label: '自费备件销售里程',
            fieldName: 'selfMile',
            disabled: true,
            placeholder: '请输入数量...'
          },
          {
            type: 'INPUT',
            label: '自费备件使用时长',
            disabled: true,
            fieldName: 'selfUseHours',
            placeholder: '请输入数量...'
          },
          {
            type: 'INPUT',
            label: '自费备件使用里程',
            disabled: true,
            fieldName: 'selfUseMile',
            placeholder: '请输入数量...'
          },
          {
            type: 'TEXT_AREA',
            label: '故障现象',
            fieldName: 'faultName',
            disabled: true,
            rows: 3,
            selfCols: 4 // 元素占据几行
          },
          {
            type: 'TEXT_AREA',
            label: '故障原因',
            fieldName: 'faultReason',
            placeholder: '故障原因',
            disabled: true,
            rows: 3,
            selfCols: 4 // 元素占据几行
          },
          {
            type: 'TEXT_AREA',
            label: '维修方案',
            fieldName: 'cmsClaimPgm',
            placeholder: '维修方案',
            disabled: true,
            rows: 3,
            selfCols: 4 // 元素占据几行
          },
          {
            type: 'BREAK_SPACE',
            label: '附件'
          },
          {
            type: 'UPLOAD_IMG',
            label: 'VIN',
            fieldName: 'wayPicture',
            selfCols: 1,
            placeholder: '上传身份证...',
            rules: [{ required: true, message: '请上传身份证', trigger: 'change' }, { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' }],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '里程（仪表）',
            fieldName: 'wayPicture1',
            selfCols: 1,
            placeholder: '上传身份证...',
            rules: [{ required: true, message: '请上传身份证', trigger: 'change' }, { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' }],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '车牌（车头）',
            fieldName: 'wayPicture2',
            offsetRightCols: 1,
            placeholder: '上传身份证...',
            rules: [{ required: true, message: '请上传身份证', trigger: 'change' }, { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' }],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '行驶证',
            fieldName: 'wayPicture3',
            selfCols: 1,
            placeholder: '上传身份证...',
            rules: [{ required: true, message: '请上传身份证', trigger: 'change' }, { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' }],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '故障照片',
            fieldName: 'wayPicture4',
            selfCols: 1,
            placeholder: '上传身份证...',
            rules: [{ required: true, message: '请上传身份证', trigger: 'change' }, { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' }],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true
            }
          },
          {
            type: 'UPLOAD_IMG',
            label: '其他文件',
            fieldName: 'wayPicture5',
            selfCols: 2,
            placeholder: '上传身份证...',
            rules: [{ required: true, message: '请上传身份证', trigger: 'change' }, { limit: 1, validator: this.validateFn, message: '请上传1张图片', trigger: 'change' }],
            upload: {
              actionUrl: '/api/file/oss/upload',
              fixedSize: [5, 3],
              limit: 1,
              isCalcHeight: true
            }
          }
        ];
      },
      //维修项目列表
      creatHeader() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: props => {
              return <span>{props.row.index + 1}</span>;
            }
          },
          { title: '维修项目代码', dataIndex: 'labourCode', sorter: true },
          { title: '维修项目名称', dataIndex: 'labourName', sorter: true },
          { title: '收费区分', dataIndex: 'cmsClaimType', sorter: true },
          { title: '标准工时', dataIndex: 'labourHours', sorter: true },
          { title: '索赔工时单价', dataIndex: 'cmsClaimPrice', sorter: true },
          { title: '索赔金额', dataIndex: 'cmsClaimAmount', sorter: true }
        ];
      },
      //备件换上件列表
      creatHeader1() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: props => {
              return <span>{props.row.index + 1}</span>;
            }
          },
          { title: '备件代码', dataIndex: 'partCode', sorter: true },
          { title: '备件名称', dataIndex: 'partName', sorter: true },
          { title: '单位', dataIndex: 'partUnit', sorter: true },
          { title: '数量', dataIndex: 'partCount', sorter: true },
          { title: '索赔单价', dataIndex: 'cmsClaimPrice', sorter: true },
          { title: '索赔总价', dataIndex: 'cmsClaimAmount', sorter: true },
          // { title: '是否电池', dataIndex: 'ifEv', sorter: true },
          // { title: '电池编号', dataIndex: 'evNo', sorter: true }
        ];
      },
      //备件换下件列表
      columnshuanxiajian1() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: props => {
              return <span>{props.row.index + 1}</span>;
            }
          },
          { title: '备件代码', dataIndex: 'partCode', sorter: true },
          { title: '备件名称', dataIndex: 'partName', sorter: true },
          { title: '单位', dataIndex: 'partUnit', sorter: true },
          { title: '数量', dataIndex: 'partCount', sorter: true },
          { title: '备件回运类型', dataIndex: 'returnType', sorter: true },
          // { title: '是否电池', dataIndex: 'ifEv', sorter: true },
          // { title: '电池编号', dataIndex: 'evNo', sorter: true }
        ];
      },
      //附加项目列表
      columnsfujiaxiangmu1() {
        return [
          {
            title: '序号',
            dataIndex: 'index',
            width: 80,
            sorter: true,
            render: props => {
              return <span>{props.row.index + 1}</span>;
            }
          },
          { title: '附加项目代码', dataIndex: 'addCode', sorter: true },
          { title: '附加项目名称', dataIndex: 'addName', sorter: true },
          { title: '附加项目费用', dataIndex: 'addAmount', sorter: true },
          { title: '备注', dataIndex: 'addRemark', sorter: true }
        ];
      },
      //费用信息
      feiyongformList1() {
        return [
          {
            type: 'INPUT',
            label: '合计费用',
            fieldName: 'sumAmount',
            initialValue: 0,
            readonly: true // 只读
          },
          {
            type: 'INPUT',
            label: '工时费用',
            fieldName: 'labourAmount',
            initialValue: 0,
            readonly: true // 只读
          },
          {
            type: 'INPUT',
            label: '备件费用',
            fieldName: 'partAmount',
            initialValue: 0,
            readonly: true // 只读
          },
          {
            type: 'INPUT',
            label: '附加项目费用',
            fieldName: 'addAmount',
            initialValue: '',
            readonly: true // 只读
          }
        ];
      },



      /**维修项目删除方法 */
      deleteFunweixiu(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success'
            });
            this.$refs.weixiuxiangmutable.$refs.pageTable.EXECUTE_DELETE([costItem]);//cmsClaimAmount
            this.feiyongformList.map(x => {
              if ('labourAmount' == x.fieldName) {
                x.initialValue = this.sumweixiufeiyongz - Number(costItem.cmsClaimAmount);
                this.sumAmount();
              }
            });
          })
      } /**备件换上件删除方法 */,
      deleteFunshangjian(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success'
            });
            this.$refs.peijianhuanshangjiantable.$refs.pageTable.EXECUTE_DELETE([costItem]);
            this.feiyongformList.map(x => {
              if ('partAmount' == x.fieldName) {
                x.initialValue = this.partAmountsumz - Number(costItem.cmsClaimPrice);
                this.sumAmount();
              }
            });
          })
      } /**备件换下件删除方法 */,
      deleteFunxiajian(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success'
            });
            this.$refs.peijianhuanxiajiantable.$refs.pageTable.EXECUTE_DELETE([costItem]);
          })
      } /*附加项目删除方法 */,
      deleteFunfujia(costItem) {
        this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async () => {
            this.$notify({
              title: '提示信息',
              message: '删除成功',
              type: 'success'
            });
            this.$refs.fujiaxiangmutable.$refs.pageTable.EXECUTE_DELETE([costItem]);
            this.feiyongformList.map(x => {
              if ('addAmount' == x.fieldName) {
                x.initialValue = this.sumfujiafeiyongz - Number(costItem.addAmount);
                this.sumAmount();
              }
            });
          })
      }
    }
  };
</script>

<style lang="less" scoped></style>
